import unittest
from cases.base_case import BaseCase
from page.index_page import IndexPage
from page.xiansuo.clue_main_page import ClueMainPage
from page.xitongbushu.xt_tjyh_kj_page import AddUserKuaijiePage
from page.tongjifenxi.tj_xstj_page import ClueCountPage

class Count(BaseCase):
# 18
    def test_xiansuo_intuo(self):
        xs=IndexPage(self.driver)
        # 进入页面
        xs.click_xiansuo_btn()
        # 断言
        dy = AddUserKuaijiePage(self.driver)
        url='http://192.168.1.25/crm/index.php?m=leads'
        self.assertIn(url,dy.get_current_url())
# 19
    def test_xiansuo_tj_intuo(self):
        xs=IndexPage(self.driver)
        # 进入页面
        xs.click_xiansuo_btn()
        # 进入统计页面
        tjinto= ClueMainPage(self.driver)
        tjinto.click_tj_btn()
        # 断言
        dy = AddUserKuaijiePage(self.driver)
        url='http://192.168.1.25/crm/index.php?m=leads&a=analytics'
        self.assertIn(url,dy.get_current_url())
# 20
    def test_xiansuo_tj_sousuo(self):
        xs = IndexPage(self.driver)
        # 进入页面
        xs.click_xiansuo_btn()
        # 进入统计页面
        tjinto = ClueMainPage(self.driver)
        tjinto.click_tj_btn()
        # 执行搜索操作
        tj_xiansuo = ClueCountPage(self.driver)
        tj_xiansuo.xstj_xzbm()
        tj_xiansuo.xstj_xzyg()
        tj_xiansuo.xstj_sousuo()
        # 断言
        text = 'admin'
        self.assertIn(text,tj_xiansuo.xstj_duanyan_biaoge(1,1))

if __name__ == '__main__':
    unittest.main()
